package com.cal.utms.action.user_maintenance;

import com.cal.utms.dto.user_maintenance.UserGroupDto;
import com.cal.utms.model.user_maintenance.UserGroupModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class UserGroupAction extends ActionSupport implements ModelDriven<UserGroupDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private UserGroupDto userGroupDto = new UserGroupDto();
	UserGroupModel groupModel = new UserGroupModel();
	private String screenids;
	private int x;

	public String getAllUserGroup() {
		userGroupDto.setSuccess(true);
		userGroupDto.setGroupDtos(groupModel.getAllUserGroup());
		return ActionSupport.SUCCESS;
	}

	public String saveUserGroup() {
		groupModel.saveUserGroup(userGroupDto, screenids);
		return ActionSupport.SUCCESS;
	}

	public String updateGroup() {
		groupModel.updateGroup(screenids, x, userGroupDto);
		return Action.SUCCESS;
	}

	@Override
	public UserGroupDto getModel() {
		return userGroupDto;
	}

	public UserGroupDto getUserGroupDto() {
		return userGroupDto;
	}

	public void setUserGroupDto(UserGroupDto userGroupDto) {
		this.userGroupDto = userGroupDto;
	}

	public String getScreenids() {
		return screenids;
	}

	public void setScreenids(String screenids) {
		this.screenids = screenids;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

}
